package com.mr.groupcomparator;

import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

/*
 * 10000001	Pdt_01	222.8
 */

public class GroupComparatorMapper extends Mapper<LongWritable, Text, GroupComparator, NullWritable>{

	GroupComparator gc = new GroupComparator();

	@Override
	protected void map(LongWritable key, Text value,
					   Mapper<LongWritable, Text, GroupComparator, NullWritable>.Context context)
			throws IOException, InterruptedException {

		String[] words = value.toString().split("\t");

		gc.setOrderId(words[0]);
		gc.setpId(words[1]);
		gc.setAcount(Double.parseDouble(words[2]));

		context.write(gc, NullWritable.get());


	}
}
